// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'
import Client from '@api/efficiency/api/EnergySupplyApi'

import OneClass from '@api/efficiency/model/EnergySupplyCommonReq'

const CLIENT = CORE.grpcCLIENT(Client)

// ============================== 导出远程接口 ============================== //

export default {
  // —————————————————————————————— 单项 —————————————————————————————— //

  async getOne({ id }, TIP = '查询单项') {
    const DTO = CORE.grpcDTO(OneClass, { id })
    const resp = await CORE.grpc(TIP, CLIENT, 'energySupplySimulation', DTO)
    const { energyElectric = {}, monitorPointSite = {}, deviceStatus } = resp
    return {
      ...energyElectric,
      point: monitorPointSite,
      deviceStatus: deviceStatus,
      id,
      monitorPointSiteName: energyElectric.monitorPointSiteName || monitorPointSite.monitorPointName,
    }
  },
}
